<?php
	require_once __DIR__ . '/Config.php';
	
	require_once __DIR__ . '/../src/OSS/yy.php';
	
    $ossClient = new OssClient(Config::OSS_ACCESS_ID, Config::OSS_ACCESS_KEY, Config::OSS_TEST_BUCKET, false);
	
	
	
	if(is_null($ossClient))
	{
		
	}
	else
	{
		$object = $resourceInfo['aliyunfile'];

		if($resourceInfo['type'] == '1')
		{
			$bucket = Config::OSS_MF_BUCKET;
			$aliyun_oss = getSignedUrlForGettingObject($ossClient, $bucket,$object);
		}
		else
		{
			$bucket = Config::OSS_TEST_BUCKET;
			$aliyun_oss = getSignedUrlForGettingObject($ossClient, $bucket,$object);
		}	
	}
	

	function getSignedUrlForGettingObject($ossClient, $bucket,$object,$timeout=3600)
	{
	    try
	    {
	        $signedUrl = $ossClient->signUrl($bucket, $object, $timeout);
	    } 
	    catch (OssException $e)
	    {
	    	
		}

	
		$request = new RequestCore($signedUrl);
		$request->set_method('GET');
		$request->add_header('Content-Type', '');
		$request->send_request();
		$res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
		if ($res->isOK())
		{
			return $signedUrl;
		}
	}
